<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function fn(username, psd, callback) {
        setTimeout(function () {
          if (username === "admin" && psd === 12345) {
            // callback("登录成功");
            return "登录成功";
          } else {
            // callback("登入失败");
            return "登入失败";
          }
        }, 1000);
      }
      let result = fn("admin11", 12345);

      setTimeout(function () {
        console.log(result);
      }, 2000);
    </script>
  </body>
</html>
